package org.wzy.springaop.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.wzy.springaop.annotation.AnnotationAspect;
import org.wzy.springaop.bean.Member;
import org.wzy.springaop.service.MemberService;

@Service
public class MemberServiceImpl implements MemberService {
	
	private static final Logger logger = LoggerFactory.getLogger(MemberServiceImpl.class);

	@Override
	public Member getMember(long id) {
		logger.info("getMember method ...");
		logger.info("id={}", id);
		
		Member m = new Member(1, "张三", 25);
		
		logger.info("m={}, mtoString={}", m, m.toString());
		
		return m;
	}

	@Override
	public Member get() {
		logger.info("get method ...");
		return new Member(2, "李四", 26);
	}

	@AnnotationAspect
	@Override
	public void save(Member m) {
		logger.info("save method ...");
	}

	@Override
	public void delete(long id) throws Exception {
		logger.info("delete method ...");
		throw new Exception("spring aop ThrowAdvice演示");
	}

}
